package com.huiyou.service;


import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.huiyou.base.BaseService;
import com.huiyou.config.Config;
import com.huiyou.mapper.AdminMapper;
import com.huiyou.model.AdminModel;
import org.springframework.cache.annotation.CacheConfig;
import org.springframework.cache.annotation.CacheEvict;
import org.springframework.cache.annotation.CachePut;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;


@Service
@CacheConfig(cacheNames = "admin")
public class AdminService extends BaseService<AdminModel, AdminMapper> {

    @Override
    public AdminModel change(AdminModel model, Map condition) {
        if (condition.get("change")!=null){
            System.out.println("装饰");
        }
        return super.change(model, condition);
    }

    @Cacheable
    @Override
    public AdminModel getById(Integer id) {
        return super.getById(id);
    }

    @CacheEvict
    @Override
    public boolean update(AdminModel model) {
        return super.update(model);
    }

    @CacheEvict
    @Override
    public boolean deleteById(Integer id) {
        return super.deleteById(id);
    }
}
